import os,re,time,zipfile
os.system('make MODE=32 OS=WIN32 FVM.exe DEMO CLI')
for i in filter(lambda x:re.match(r'.+(swp|~)$',x),os.listdir('.')):
    os.system('del %s'%i)
NOW='%.4i%.2i%.2i.%.2i%.2i'%time.localtime()[:5]
ZIPNAME='\\backup\\FVM\\%s.zip'%NOW
zip=zipfile.ZipFile(ZIPNAME,'w',zipfile.ZIP_DEFLATED)
map(lambda x:zip.write(x),filter(lambda fn:re.match(r'^(FVM.exe|[A-Z]+|Makefile|.+\.(cpp|4th|py|bat|html))$',fn),os.listdir('.')))
zip.write('C:\\Dev-Cpp\\bin\\gforth.exe','gforth.exe')
zip.write('C:\\Dev-Cpp\\bin\\gforth.fi','gforth.fi')
zip.close()
raw_input('press ENTER to upload...')
os.system('pscp %s root@akps.ssau.ru:/var/www/forth/FVM.zip'%ZIPNAME)
